﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Text;
using System.Collections.Generic;

namespace SmartSpace.UI.Silverlight.Dynamic.DynamicRef
{
    public partial class DataInstance
    {
        public object this[string key]
        {
            get
            {
                foreach (FieldInstance data in this.Fields)
                {
                    if (data.Name == key)
                    {
                        FieldInstance fi = new FieldInstance();
                        fi.Text = data.Text;
                        fi.Value = data.Value;
                        return fi;
                    }
                }
                return null;
            }
            set
            {
                foreach (FieldInstance data in this.Fields)
                {
                    if (data.Name == key)
                    {
                        FieldInstance fi = value as FieldInstance;
                        data.Text = fi.Text;
                        data.Value = fi.Value;
                    }
                }
            }
        }
    }
}
